package threads;

import java.util.concurrent.*;

/**
 * created by flyketch
 * 19-9-19 上午10:48
 */
public class ThreadPoolTest {

    private static ExecutorService pool;

    public static void main(String[] args) {
        pool = new ThreadPoolExecutor(1, 2, 1000,
                TimeUnit.MILLISECONDS, new PriorityBlockingQueue<Runnable>(),
                Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());

        for(int i=0;i<10;i++) {
            pool.execute(new ThreadTask(i));
        }

//        pool = new ThreadPoolExecutor(1, 2, 1000,
//                TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(),
//                Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
//        for (int i = 0; i < 3; i++) {
//            pool.execute(new SyncQueueThreadTask());
//        }
    }
}
